import { ref } from 'vue';
import { Application } from '@splinetool/runtime';

export const useInit3dModel = () => {
  const loading = ref(false);
  const ref3d = ref();
  const init3dModel = () => {
    const spline = new Application(ref3d.value);
    loading.value = true;
    // spline.load('https://fe-hmzs.itheima.net/scene.splinecode'); 💥💥模型比较大，渲染会卡主
    spline.load('https://prod.spline.design/6Wq1Q7YGyM-iab9i/scene.splinecode').then(() => {
      loading.value = false;
    });
  };

  return { loading, ref3d, init3dModel };
};
